
    /*
     * Ext.ux.form.MultiSelect Example Code
     */
    var msForm = new Ext.form.FormPanel({
        title: 'MultiSelect Test',
        width: 700,
        bodyStyle: 'padding:10px;',
        baseCls : 'x-plain',
		bodyStyle : 'padding:5px 5px 0',
		anchor : '90%',
		defaults : {
			msgTarget : 'side'
		},
//        renderTo: 'multiselect',
        items:[{
            xtype: 'multiselect',
            fieldLabel: 'Multiselect<br />(Required)',
            name: 'multiselect',
            width: 250,
            height: 200,
            allowBlank:false,
            store: [[123,'One Hundred Twenty Three'],
                    ['1', 'One'], ['2', 'Two'], ['3', 'Three'], ['4', 'Four'], ['5', 'Five'],
                    ['6', 'Six'], ['7', 'Seven'], ['8', 'Eight'], ['9', 'Nine']],
            tbar:[{
                text: 'clear',
                handler: function(){
	                msForm.getForm().findField('multiselect').reset();
	            }
            }],
            ddReorder: true
        }],
        tbar:[{
            text: 'Options',
            menu: [{
	            text: 'Set Value (2,3)',
	            handler: function(){
	                msForm.getForm().findField('multiselect').setValue('2,3');
	            }
	        },{
	            text: 'Toggle Enabled',
	            handler: function(){
	                var m = msForm.getForm().findField('multiselect');
	                if (!m.disabled) {
	                    m.disable();
	                } else {
	                    m.enable();
	                }
	            }
            }]
        }],

        buttons: [{
            text: 'Save',
            handler: function(){
                if(msForm.getForm().isValid()){
	                Ext.Msg.alert('Submitted Values', 'The following will be sent to the server: <br />'+
	                    msForm.getForm().getValues(true));
                }
            }
        }]
    });


    var ds = new Ext.data.ArrayStore({
        data: [[123,'One Hundred Twenty Three'],
            ['1', 'One'], ['2', 'Two'], ['3', 'Three'], ['4', 'Four'], ['5', 'Five'],
            ['6', 'Six'], ['7', 'Seven'], ['8', 'Eight'], ['9', 'Nine']],
        fields: ['value','text'],
        sortInfo: {
            field: 'value',
            direction: 'ASC'
        }
    });

    /*
     * Ext.ux.form.ItemSelector Example Code
     */
    var formpanel_orggoalsetting = new Ext.form.FormPanel({
        title: '被考核部门指标设置',
        width:700,
//        bodyStyle: 'padding:10px;',
//        renderTo: 'itemselector',
        items:[{
            xtype: 'itemselector',
            name: 'orgGoalSetting.orgId',
            fieldLabel: '选择被考核部门',
			allowBlank : false,
			emptyText : '请选择被考核部门',
	        imagePath: '/supervise/ux/images/',
            multiselects: [{
                width: 250,
                height: 150,
                store: ds_org_select,
                displayField: 'name',
                valueField: 'id'
            },{
                width: 250,
                height: 150,
                store: new Ext.data.ArrayStore({
					data: [],
					fields:['id','name']
				}),
                displayField: 'name',
                valueField: 'id'
            }]
        },{
			xtype : 'combo',
			fieldLabel : '指标类型',
			hiddenName  : 'orgGoalSetting.type',
			allowBlank : false,
			readOnly : true,
			editable : false,
			store : new Ext.data.SimpleStore({
						data : data_goal_type,
						fields : ['text', 'value']
					}),
			displayField : 'text',
			valueField : 'value',
			mode : 'local',
			value: 'normal',
			triggerAction : 'all',
			emptyText : '请选择类型',
			listeners : {
				'select' : function(combo, record, index) {
					var typeValue =  combo.getValue();
					alert(typeValue);
					if(Ext.isEmpty(typeValue)){
						typeValue = 'normal';
					} 
				try {
					var detailId = Ext.getCmp('orgGoalSetting_goalId');
					detailId.clearValue();
					detailId.store.reload({
								params : {
									type : typeValue
								}
							});
				} catch (ex) {
					Ext.MessageBox.alert(ex);
				}
			
				}
			}
		},{
            xtype: 'itemselector',
            name: 'orgGoalSetting.goalId',
            fieldLabel: '选择考核指标',
            allowBlank : false,
			emptyText : '请选择考核指标',
	        imagePath: '/supervise/ux/images/',
            multiselects: [{
            	id: 'orgGoalSetting_goalId',
                width: 250,
                height: 150,
                mode : 'local',
                store:  new Ext.data.Store({
									url : '/supervise/biz/orgcheck/findGoalByType.action',
									autoLoad : true,
									reader : new Ext.data.JsonReader({
											root : 'root'
										}, [{
												name : 'id',
												type : 'int'
											}, {
												name : 'name',
												type : 'string'
											}])
								}),
                displayField: 'name',
                valueField: 'id'
            },{
                width: 250,
                height: 150,
                store: new Ext.data.ArrayStore({
					data: [],
					fields:['id','name']
				}),
                displayField: 'name',
                valueField: 'id'
            }]
        }],

        buttons: [{
            text: '保存设置',
            handler: function(){
            	var frm = formpanel_orggoalsetting.getForm();
            	var orgIds = frm.findField('orgGoalSetting.orgId').getValue();
            	var goalIds = frm.findField('orgGoalSetting.goalId').getValue();
            	if(Ext.isEmpty(orgIds) || Ext.isEmpty(goalIds)){
            		 Ext.Msg.alert('请选择正确的数据');
            		 return;
            	}
                Ext.Msg.confirm('确认保存数据','是否确认要保存指定被考核部门指标设置？', function(btn) {
					if (btn == 'yes') { 
						Ext.Ajax.request({
									url : '/supervise/biz/orggoalsetting/saveOrgGoalSetting.action',
									params : {
										orgIds : orgIds,
										goalIds : goalIds,
										goalType: frm.findField('orgGoalSetting.type').getValue()
									},
									success : function(response,opts) {
									  Ext.Msg.show({
													title : '成功提示',
													msg : '已成功保存数据!',
													buttons : Ext.Msg.OK,
													icon : Ext.Msg.OK
												});
									},
									failure : function(response,opts) {
										Ext.Msg.show({
													title : '错误提示',
													msg : '保存时发生错误!',
													buttons : Ext.Msg.OK,
													icon : Ext.Msg.ERROR
												});
									}
								});
					}
                });
            }
        }]
    });


//var qpanel_orggoalsetting = new Ext.Panel({
////	title : '<h3 style="color:Green">请输入查询条件</h3>',
//	height : 140,
//	region : "north",
//	baseCls:"x-plain",
//	style:"padding:5px",
//	layout:"column",
//	items:[{
//		columnWidth:0.6,
//		id: 'form_query_democracygoal',
//		layout:"form",
//		frame : true,
//		layout : 'form',
//		baseCls : 'x-plain',
//		labelAlign : 'right',
//		border : false,
//		bodyStyle : 'padding:5px 5px 0',
//		defaults : {
//			anchor : '90%',
//			width : 240,
//			msgTarget : 'side' // 验证信息显示右边
//		},
//		defaultType : 'textfield',
//		items:[{
//			   xtype:'multicombo',
//			   width:250,
//			   height: 100,
//			   minHeight : 100,
//			   store: new Ext.data.SimpleStore({
//			       fields: ["name","value"],
//			       data:[['测试菜单1',1],['测试菜单2',2],['测试菜单3',3],['测试菜单4',4]]}),
//			   valueField :"value",
//			   displayField: "name",
//			   labelSeparator:'：',
//			   displaySeparator:';',
//			   valueSeparator:',',
//			   mode: 'local',
//			   value:'1,2',
//			   forceSelection: true,
//			   hiddenName:'test',
//			   editable: true,
//			   triggerAction: 'all',
//			   allowBlank:false,
//			   pageSize : 10,
//			   emptyText:'请选择',
//			   fieldLabel: '多选下拉ComBo'
//			},{
//				fieldLabel : '考核内容',
//				name : 'content'
//			}],
//		buttonAlign : 'center',
//		minButtonWidth : 60,
//		buttons : [{
//					text : '查询',
//					handler : function(btn) {
//						var items = btn.ownerCt.ownerCt.items;
//						ds_democracygoal.load({params : {
//							start : 0,limit : 20,
//							year : items.get(0).getValue(),
//							content : items.get(1).getValue()
//						}});}
//				},{
//					text : '重置',
//					handler : function() { 
//					}
//				}]
//	}]
//});
//var item_select =  new Ext.Panel({
//	id :  "multiselect",
//	frame : false,
//	region : 'center',
//	labelWidth : 65,
//	title : '社会评价指标',
//	labelPad : 45,
//	buttonAlign : 'center',
//	layout : 'border'
////	items :[new Ext.form.FormPanel({
////        title: 'MultiSelect Test',
////        width: 700,
////        bodyStyle: 'padding:10px;',
////        renderTo: 'multiselect',
////        items:[{
////            xtype: 'multiselect',
////            fieldLabel: 'Multiselect<br />(Required)',
////            name: 'multiselect',
////            width: 250,
////            height: 200,
////            allowBlank:false,
////            store: [[123,'One Hundred Twenty Three'],
////                    ['1', 'One'], ['2', 'Two'], ['3', 'Three'], ['4', 'Four'], ['5', 'Five'],
////                    ['6', 'Six'], ['7', 'Seven'], ['8', 'Eight'], ['9', 'Nine']],
////            tbar:[{
////                text: 'clear',
////                handler: function(){
//////	                msForm.getForm().findField('multiselect').reset();
////	            }
////            }],
////            ddReorder: true
////        }],
////        tbar:[{
////            text: 'Options',
////            menu: [{
////	            text: 'Set Value (2,3)',
////	            handler: function(){
//////	                msForm.getForm().findField('multiselect').setValue('2,3');
////	            }
////	        },{
////	            text: 'Toggle Enabled',
////	            handler: function(){
//////	                var m = msForm.getForm().findField('multiselect');
//////	                if (!m.disabled) {
//////	                    m.disable();
//////	                } else {
//////	                    m.enable();
//////	                }
////	            }
////            }]
////        }],
////
////        buttons: [{
////            text: 'Save',
////            handler: function(){
//////                if(msForm.getForm().isValid()){
//////	                Ext.Msg.alert('Submitted Values', 'The following will be sent to the server: <br />'+
//////	                    msForm.getForm().getValues(true));
//////                }
////            }
////        }]
////    })]
//			  });
//var query_orggoalsetting =  new Ext.Panel({
//	frame : false,
//	region : 'center',
//	labelWidth : 65,
//	title : '社会评价指标',
//	labelPad : 45,
//	buttonAlign : 'center',
//	layout : 'border',
//	items : [qpanel_orggoalsetting, item_select]
//});	
var orggoalsetting_panel = new Ext.Panel({
	frame : false,
	region : 'center',
	baseCls : "x-plain",
	style : "padding:5px",
	items : [formpanel_orggoalsetting]
});
var p_orggoalsetting = {
	id : 'orggoalsetting-panel',
	border : false,
	layout : 'border',
	items : [orggoalsetting_panel]
};